package com.nbsaas.boot.data.rest.convert;

import com.nbsaas.boot.data.data.entity.QueryDebug;
import com.nbsaas.boot.data.api.domain.response.QueryDebugResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;
/**
* 调试记录-实体对象转化成响应对象
*/

public class QueryDebugResponseConvert  implements Converter<QueryDebugResponse,QueryDebug> {

    @Override
    public QueryDebugResponse convert(QueryDebug source) {
        QueryDebugResponse  result = new  QueryDebugResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getQueryTemplate()!=null){
                        result.setQueryTemplate(source.getQueryTemplate().getId());
                    }

                    try {
                        if(source.getQueryTemplate()!=null){
                            result.setQueryTemplateName(source.getQueryTemplate().getName());
                        }
                    } catch (Exception ignored) { }

        return result;
    }

}

